﻿using System;
using System.Windows;
using DyUi.Base.Interfaces;

namespace DyUi.Core
{
    public class DyUiShell
    {
        readonly IDyUiController _controller;

        readonly Window _mainWindow;
        
        /// <summary>
        /// Initializes a new instance of the DyUiShell class.
        /// </summary>
        public DyUiShell(IDyUiController controller)
        {
            _controller = controller;
            _mainWindow = new Window();
        }
        
        public virtual void Prepare()
        {
            RootControl = _controller.ControlSubSystem.CreateControl(RootControlPath);
            RootControl.Prepare();

            _controller.ControlSubSystem.RootControl = RootControl;

            _mainWindow.Content = RootControl;
        }

        public virtual void Start()
        {
            _controller.Start();
            _mainWindow.Show();
        }

        public virtual String RootControlPath
        {
            get
            {
                return @"D:\Development\Projects\DyUi\DyUi\bin\Debug\AppControls\AppLayout_Default.dyui";
            }
            
        }

        public IDyUiControl RootControl { get; set; }
    }
}
